﻿@using Abp.Json
@using AbpZeroTemplate.MultiTenancy
@using AbpZeroTemplate.Web.Areas.AppAreaName.Models.Common.Modals
@using AbpZeroTemplate.Web.Areas.AppAreaName.Models.Tenants
@model CreateTenantViewModel
<script>
    window.passwordComplexitySetting = @Html.Raw(Model.PasswordComplexitySetting.ToJsonString(indented: true));
</script>
@Html.Partial("~/Areas/AppAreaName/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("CreateNewTenant")))

<div class="modal-body">
    <form name="TenantInformationsForm">
        <div class="form-group">
            <label for="TenancyName">@L("TenancyName")</label>
            <input id="TenancyName" class="form-control" type="text" name="TenancyName" required maxlength="@Tenant.MaxTenancyNameLength" regex="@Tenant.TenancyNameRegex">
        </div>

        <div class="form-group no-hint">
            <label for="Name">@L("Name")</label>
            <input id="Name" type="text" name="Name" class="form-control" required maxlength="@Tenant.MaxNameLength">
        </div>

        <div class="m-checkbox-list">
            <label class="m-checkbox">
                <input id="CreateTenant_UseHostDb" type="checkbox" name="UseHostDb" value="true" checked="checked">
                @L("UseHostDatabase")
                <span></span>
            </label>
        </div>

        <div class="form-group no-hint" style="display: none">
            <label for="ConnectionString">@L("DatabaseConnectionString")</label>
            <input id="ConnectionString" type="text" name="ConnectionString" class="form-control" required maxlength="@Tenant.MaxConnectionStringLength">
        </div>

        <div class="form-group">
            <label for="AdminEmailAddress">@L("AdminEmailAddress")</label>
            <input id="AdminEmailAddress" type="email" name="AdminEmailAddress" class="form-control" required maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxEmailAddressLength">
        </div>

        <div class="m-checkbox-list">
            <label class="m-checkbox">
                <input id="CreateTenant_SetRandomPassword" type="checkbox" name="SetRandomPassword" value="true" checked="checked" />
                @L("SetRandomPassword")
                <span></span>
            </label>
        </div>

        <div class="form-group no-hint tenant-admin-password" style="display: none">
            <label for="CreateTenant_AdminPassword">@L("Password")</label>
            <input id="CreateTenant_AdminPassword" type="password" name="AdminPassword" class="form-control" maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxPlainPasswordLength" autocomplete="off">
        </div>

        <div class="form-group tenant-admin-password" style="display: none">
            <label for="AdminPasswordRepeat">@L("PasswordRepeat")</label>
            <input id="AdminPasswordRepeat" type="password" name="AdminPasswordRepeat" class="form-control" maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxPlainPasswordLength" equalto="#CreateTenant_AdminPassword" autocomplete="off">
        </div>

        <div class="form-group no-hint">
            <label for="EditionId">@L("Edition")</label>
            <select class="form-control" id="EditionId" name="EditionId">
                @foreach (var edition in Model.EditionItems)
                {
                    <option value="@edition.Value" data-isfree="@edition.IsFree">@edition.DisplayText</option>
                }
            </select>
        </div>

        <div class="m-checkbox-list subscription-component">
            <label for="CreateTenant_IsUnlimited" class="m-checkbox">
                <input id="CreateTenant_IsUnlimited" type="checkbox" name="IsUnlimited" />
                @L("UnlimitedTimeSubscription")
                <span></span>
            </label>
        </div>

        <div class="form-group subscription-component">
            <label for="SubscriptionEndDateUtc">@L("SubscriptionEndDateUtc")</label>
            <input id="SubscriptionEndDateUtc" type="datetime" name="SubscriptionEndDateUtc" class="form-control date-time-picker" required>
        </div>

        <div class="m-checkbox-list subscription-component">
            <label for="CreateTenant_IsInTrialPeriod" class="m-checkbox">
                <input id="CreateTenant_IsInTrialPeriod" class="md-check" type="checkbox" name="IsInTrialPeriod" value="true" />
                @L("IsInTrialPeriod")
                <span></span>
            </label>
        </div>

        <div class="m-checkbox-list">
            <label for="CreateTenant_ShouldChangePasswordOnNextLogin" class="m-checkbox">
                <input id="CreateTenant_ShouldChangePasswordOnNextLogin" type="checkbox" name="ShouldChangePasswordOnNextLogin" value="true" checked="checked">
                @L("ShouldChangePasswordOnNextLogin")
                <span></span>
            </label>
            <label for="CreateTenant_SendActivationEmail" class="m-checkbox">
                <input id="CreateTenant_SendActivationEmail" type="checkbox" name="SendActivationEmail" value="true" checked="checked">
                @L("SendActivationEmail")
                <span></span>
            </label>
            <label for="CreateTenant_IsActive" class="m-checkbox">
                <input id="CreateTenant_IsActive" type="checkbox" name="IsActive" value="true" checked="checked">
                @L("Active")
                <span></span>
            </label>
        </div>
    </form>
</div>

@Html.Partial("~/Areas/AppAreaName/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")